package com.zgm.ch04._7_1;

import java.io.File;
import java.net.URL;
import java.util.Locale;
import java.util.Properties;
import java.util.regex.Pattern;

import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.ClassPathResource;

public class PropertyEditorBean {

	private Class cls;
	private File file;
	private URL url;
	private Locale locale;
	private Properties properties;
	private String[] strings;
	private byte[] bytes;
	private Pattern pattern;
	
	
	public static void main(String[] args){
		BeanFactory factory = new XmlBeanFactory(new ClassPathResource("com/zgm/ch04/_7_1/_7_1-context.xml"));
		
		PropertyEditorBean bean = (PropertyEditorBean) factory.getBean("propertyEditorBean");
	}
	
	
	public void setCls(Class cls) {
		System.out.println("设置class:" + cls.getName());
		this.cls = cls;
	}
	public void setFile(File file) {
		System.out.println("设置File:" + file.getName());
		this.file = file;
	}
	public void setUrl(URL url) throws Exception {
		System.out.println("设置Url:" + url.toExternalForm());
		System.out.println("设置Url:" + url.toURI());
		this.url = url;
	}
	public void setLocale(Locale locale) {
		System.out.println("设置Locale:" + locale.getDisplayName());
		this.locale = locale;
	}
	public void setProperties(Properties properties) {
		System.out.println("加载Properties:" + properties.size() + " properties");
		this.properties = properties;
	}
	public void setStrings(String[] strings) {
		System.out.println("加载strings:" + strings.length + " string");
		System.out.println("设置strings:" + strings);
		this.strings = strings;
	}
	public void setBytes(byte[] bytes) {
		System.out.println("加载bytes:" + bytes.length + " byte");
		System.out.println("设置bytes:" + bytes);
		this.bytes = bytes;
	}
	public void setPattern(Pattern pattern) {
		System.out.println("设置Pattern:" + pattern);
		this.pattern = pattern;
	}
	
}
